#include "Stack(Array).h"
#include<iostream>

void initStack(Stack* table)
{
	table->top = 0;
	table->data[table->top] = 0;
}

void push_stack(Stack* table, Element_t e)
{
	if (isFull(table))
	{
		return;
	}
	table->data[table->top] = e;
	++table->top;
}

int popStack(Stack* table, Element_t e)
{
	if (isEmpty(table))
	{
		return 0;
	}
	else {
		--table->top;
	}
	return 1;
}

Element_t getTop(Stack* table)
{
	return table->data[table->top-1];
}

bool isEmpty(Stack* table)
{
	if (table->top == 0)
	{
		return true;
	}
	return false;
}

bool isFull(Stack* table)
{
	if (table->top == maxsize)
	{
		return true;
	}
	return false;
}
